/*********************\
* Author:Dzlua
* QQ:505544956
* Time:2017/04/11
\**********************/
#include "LuaButton.h"

#define CObjPtr ((CButtonUI*)m_cobj)

namespace DuiLib {

bool LuaButton::Activate()
{
    return CObjPtr->Activate();
}

void LuaButton::SetEnabled(bool bEnable)
{
    CObjPtr->SetEnabled(bEnable);
}

int LuaButton::GetNormalImage(LuaState *L)
{
    SDTString str = CObjPtr->GetNormalImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaButton::SetNormalImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetNormalImage(str.c_str());
    return 0;
}

int LuaButton::GetHotImage(LuaState *L)
{
    SDTString str = CObjPtr->GetHotImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaButton::SetHotImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetHotImage(str.c_str());
    return 0;
}

int LuaButton::GetPushedImage(LuaState *L)
{
    SDTString str = CObjPtr->GetPushedImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaButton::SetPushedImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetPushedImage(str.c_str());
    return 0;
}

int LuaButton::GetFocusedImage(LuaState *L)
{
    SDTString str = CObjPtr->GetFocusedImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaButton::SetFocusedImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetFocusedImage(str.c_str());
    return 0;
}

int LuaButton::GetDisabledImage(LuaState *L)
{
    SDTString str = CObjPtr->GetDisabledImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaButton::SetDisabledImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetDisabledImage(str.c_str());
    return 0;
}

int LuaButton::GetHotForeImage(LuaState *L)
{
    SDTString str = CObjPtr->GetHotForeImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

int LuaButton::SetHotForeImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetHotForeImage(str.c_str());
    return 0;
}

void LuaButton::BindTabIndex(int _BindTabIndex)
{
    CObjPtr->BindTabIndex(_BindTabIndex);
}

int LuaButton::BindTabLayoutName(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->BindTabLayoutName(str.c_str());
    return 0;
}

void LuaButton::BindTriggerTabSel(int _SetSelectIndex)
{
    CObjPtr->BindTriggerTabSel(_SetSelectIndex);
}

void LuaButton::RemoveBindTabIndex()
{
    CObjPtr->RemoveBindTabIndex();
}

int	 LuaButton::GetBindTabLayoutIndex()
{
    return CObjPtr->GetBindTabLayoutIndex();
}

int LuaButton::GetBindTabLayoutName(LuaState *L)
{
    SDTString str = CObjPtr->GetBindTabLayoutName();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

void LuaButton::SetHotBkColor(DWORD dwColor)
{
    CObjPtr->SetHotBkColor(dwColor);
}

DWORD LuaButton::GetHotBkColor()
{
    return CObjPtr->GetHotBkColor();
}

void LuaButton::SetPushedBkColor(DWORD dwColor)
{
    CObjPtr->SetPushedBkColor(dwColor);
}

DWORD LuaButton::GetPushedBkColor()
{
    return CObjPtr->GetPushedBkColor();
}

void LuaButton::SetHotTextColor(DWORD dwColor)
{
    CObjPtr->SetHotTextColor(dwColor);
}

DWORD LuaButton::GetHotTextColor()
{
    return CObjPtr->GetHotTextColor();
}

void LuaButton::SetPushedTextColor(DWORD dwColor)
{
    CObjPtr->SetPushedTextColor(dwColor);
}

DWORD LuaButton::GetPushedTextColor()
{
    return CObjPtr->GetPushedTextColor();
}

void LuaButton::SetFocusedTextColor(DWORD dwColor)
{
    CObjPtr->SetFocusedTextColor(dwColor);
}

DWORD LuaButton::GetFocusedTextColor()
{
    return CObjPtr->GetFocusedTextColor();
}

SDLUA_BEGIN_REGISTER(LuaButton, Button, Label)
    SDLUA_REGISTER_FUN_CPP(LuaButton, Activate, Activate)
    SDLUA_REGISTER_FUN_CPP(LuaButton, SetEnabled, SetEnabled)

    SDLUA_REGISTER_FUN_LUA(LuaButton, GetNormalImage, GetNormalImage)
    SDLUA_REGISTER_FUN_LUA(LuaButton, SetNormalImage, SetNormalImage)
    SDLUA_REGISTER_FUN_LUA(LuaButton, GetHotImage, GetHotImage)
    SDLUA_REGISTER_FUN_LUA(LuaButton, SetHotImage, SetHotImage)
    SDLUA_REGISTER_FUN_LUA(LuaButton, GetPushedImage, GetPushedImage)
    SDLUA_REGISTER_FUN_LUA(LuaButton, SetPushedImage, SetPushedImage)
    SDLUA_REGISTER_FUN_LUA(LuaButton, GetFocusedImage, GetFocusedImage)
    SDLUA_REGISTER_FUN_LUA(LuaButton, SetFocusedImage, SetFocusedImage)
    SDLUA_REGISTER_FUN_LUA(LuaButton, GetDisabledImage, GetDisabledImage)
    SDLUA_REGISTER_FUN_LUA(LuaButton, SetDisabledImage, SetDisabledImage)
    SDLUA_REGISTER_FUN_LUA(LuaButton, GetHotForeImage, GetHotForeImage)
    SDLUA_REGISTER_FUN_LUA(LuaButton, SetHotForeImage, SetHotForeImage)

    SDLUA_REGISTER_FUN_CPP(LuaButton, BindTabIndex, BindTabIndex)
    SDLUA_REGISTER_FUN_LUA(LuaButton, BindTabLayoutName, BindTabLayoutName)
    SDLUA_REGISTER_FUN_CPP(LuaButton, BindTriggerTabSel, BindTriggerTabSel)
    SDLUA_REGISTER_FUN_CPP(LuaButton, RemoveBindTabIndex, RemoveBindTabIndex)
    SDLUA_REGISTER_FUN_CPP(LuaButton, GetBindTabLayoutIndex, GetBindTabLayoutIndex)
    SDLUA_REGISTER_FUN_CPP(LuaButton, GetBindTabLayoutName, GetBindTabLayoutName)

    SDLUA_REGISTER_FUN_CPP(LuaButton, SetHotBkColor, SetHotBkColor)
    SDLUA_REGISTER_FUN_CPP(LuaButton, GetHotBkColor, GetHotBkColor)
    SDLUA_REGISTER_FUN_CPP(LuaButton, SetPushedBkColor, SetPushedBkColor)
    SDLUA_REGISTER_FUN_CPP(LuaButton, GetPushedBkColor, GetPushedBkColor)
    SDLUA_REGISTER_FUN_CPP(LuaButton, SetHotTextColor, SetHotTextColor)
    SDLUA_REGISTER_FUN_CPP(LuaButton, GetHotTextColor, GetHotTextColor)
    SDLUA_REGISTER_FUN_CPP(LuaButton, SetPushedTextColor, SetPushedTextColor)
    SDLUA_REGISTER_FUN_CPP(LuaButton, GetPushedTextColor, GetPushedTextColor)
    SDLUA_REGISTER_FUN_CPP(LuaButton, SetFocusedTextColor, SetFocusedTextColor)
    SDLUA_REGISTER_FUN_CPP(LuaButton, GetFocusedTextColor, GetFocusedTextColor)

SDLUA_END_REGISTER

SDLUA_BEGIN_UNREGISTER(LuaButton, Button)
SDLUA_END_UNREGISTER(Button)

}

#undef CObjPtr